<template>
    <div class="table">
        <div class="divSearch">
            <!--搜索框-->
            <Row>
                <!--根据需求删除不不要查询条件-->
                <Col :lg="{span:1}" :md="{span:3}" :sm="{span:4}" :xs="{span:4}" class="searchLabel">
                    <label>填报年度:</label>
                </Col>
                <Col :lg="{span:3}" :md="{span:4}" :sm="{span:8}" :xs="{span:20}">
                    <Select v-model="searchModel.FillInYear" placeholder="全部" style="width: 150px" @on-change="getPageData()" class="searchInput">
                            <Option value="">全部</Option>
                            <Option :value="item.DictValue" v-for="item in CreateYearList" :key="item.DictValue">{{item.DictText}}</Option>
                        </Select>
                </Col>
                <Col :lg="{span:1}" :md="{span:3}" :sm="{span:4}" :xs="{span:4}" class="searchLabel">
                    <label>时间周期:</label>
                </Col>
                <Col :lg="{span:3}" :md="{span:4}" :sm="{span:8}" :xs="{span:20}">
                    <Select v-model="searchModel.TimesType" placeholder="全部" style="width: 150px" @on-change="getPageData()" class="searchInput">
                            <Option value="">全部</Option>
                            <Option :value="item.DictValue" v-for="item in CycleList" :key="item.DictValue">{{item.DictText}}</Option>
                        </Select>
                </Col>
                <Col :lg="{span:2}" :md="{span:2}" :sm="{span:2}" :xs="{span:2}">
                    <Button icon="ios-search" type="primary" @click="getPageData()" class="searchButton">查询</Button>
                </Col>

                <Col :lg="{span:2}" :md="{span:2}" :sm="{span:2}" :xs="{span:2}" style="float:right">
                    <Button icon="ios-cloud-download" type="primary" @click="TmpDown()" class="searchButton">模板下载</Button>
                </Col>
            </Row>
        </div>
        <Row>
            <Col>
                <Table class="" :context="self" ref="table" :stripe=true :border=true :columns="TableHeader" :data="datas.rows" size="large" :height="clientHeight">
                </Table>
            </Col>
        </Row>
        <Row>
            <Col span="24">
                <Page class="pageComponent"  :total="datas.total" placement="top" @on-change="getPageNumber" :page-size="searchModel.PageSize" :page-size-opts='pageSizeOpts' show-sizer @on-page-size-change="getPageSize" show-total show-elevator></Page>
            </Col>
        </Row>
        <!--**********************************数据编辑框***************************************************************-->
        <Modal v-model="showType" :mask-closable="false" width="1200">
            <p slot="header" class="title">
                <Icon type="ios-paper" size="20"></Icon>
                <span style="font-size: 20px">蔬菜经营实体情况填报表</span>
            </p>
            <p slot="close">
                <Icon type="close-circled" color="red" size=25></Icon>
            </p>
            <Tabs type="card" @on-click="getTab">
                <Tab-pane label="蔬菜企业" >
                    <table class="reportTable">
                        <thead>
                            <tr>
                                <td rowspan="2">总数(个)</td>
                                <td colspan="3">龙头企业(个)</td>
                                <td colspan="6">按产值分(个)</td>
                                <td colspan="4">育苗企业(个)</td>
                            </tr>
                            <tr>
                                <td>总数</td>
                                <td>省级及以上</br>龙头企业</td>
                                <td>州县(市)级</br>龙头企业</td>
                                <td>1000万元以下</td>
                                <td>1000～5000万元</td>
                                <td>5000万～1亿元</td>
                                <td>1～5亿元</td>
                                <td>5～10亿元</td>
                                <td>10亿元以上</td>
                                <td>总数</td>
                                <td>育苗500万株以下</td>
                                <td>育苗500万株-1000万株</td>
                                <td>育苗1000万株以上</td>
                            </tr>
                        </thead>
                        <tr>
                            <td><Input v-model="dataModel.VegCompanyNum"></Input></td>
                            <td><Input v-model="dataModel.ZzNum_Num"></Input></td>
                            <td><Input v-model="dataModel.ZzNum_pro"></Input></td>
                            <td><Input v-model="dataModel.ZzNum_city"></Input></td>
                            <td><Input v-model="dataModel.ZzNum_yye1"></Input></td>
                            <td><Input v-model="dataModel.ZzNum_yye2"></Input></td>
                            <td><Input v-model="dataModel.ZzNum_yye3"></Input></td>
                            <td><Input v-model="dataModel.ZzNum_yye4"></Input></td>
                            <td><Input v-model="dataModel.ZzNum_yye5"></Input></td>
                            <td><Input v-model="dataModel.ZzNum_yye6"></Input></td>
                            <td><Input v-model="dataModel.YmqyNum"></Input></td>
                            <td><Input v-model="dataModel.Ymqy1"></Input></td>
                            <td><Input v-model="dataModel.Ymqy2"></Input></td>
                            <td><Input v-model="dataModel.Ymqy3"></Input></td>
                        </tr>
                    </table>
                </Tab-pane>
                <Tab-pane label="蔬菜经营主体" >
                    <table class="reportTable">
                        <thead>
                            <tr>
                                <td>蔬菜专业合作组织数量(个)</td>
                                <td>参加蔬菜合作组织农户数(个)</td>
                                <td>蔬菜合作组织种植面积(亩)</td>
                            </tr>
                        </thead>
                        <tr>
                            <td><Input v-model="dataModel.VegHzNum"></Input></td>
                            <td><Input v-model="dataModel.VegNhNum"></Input></td>
                            <td><Input v-model="dataModel.VegMjNum"></Input></td>
                        </tr>
                    </table>
                </Tab-pane>
                <Tab-pane label="相关质量标准认证情况" >
                    <table class="reportTable">
                        <thead>
                            <tr>
                                <td>国家级农业标准化示范县数量(个)</td>
                                <td>出口食品农产品质量安全示范区数量(个)</td>
                                <td>注册商标数(个)</td>
                                <td>出口基地备案面积(万亩)</td>
                                <td>GAP认证面积(万亩)</td>
                                <td>GAP认证产品数量(个)</td>
                                <td>无公害农产品数量(个)</td>
                                <td>无公害农产品认证面积(亩)</td>
                                <td>绿色产品认证数(个)</td>                                
                                <td>绿色产品认证面积(亩)</td>
                                <td>地理标志证明商标数(个)</td>
                                <td>地理标志产品保护认证数(个)</td>
                            </tr> 
                        </thead>
                    <tr>
                        <td><Input v-model="dataModel.ZlrzNum_sfx"></Input></td>
                        <td><Input v-model="dataModel.ZlrzNum_sfq"></Input></td>
                        <td><Input v-model="dataModel.ZlrzNum_sbs"></Input></td>
                        <td><Input v-model="dataModel.ZlrzNum_bamj"></Input></td>
                        <td><Input v-model="dataModel.ZlrzNum_rzmj"></Input></td>
                        <td><Input v-model="dataModel.ZlrzNum_rzsl"></Input></td>
                        <td><Input v-model="dataModel.ZlrzNum_wghmj"></Input></td>
                        <td><Input v-model="dataModel.ZlrzNum_bluecp"></Input></td>
                        <td><Input v-model="dataModel.ZlrzNum_bluecpmj"></Input></td>
                        <td><Input v-model="dataModel.ZlrzNum_dlsb"></Input></td>
                        <td><Input v-model="dataModel.ZlrzNum_dlbh"></Input></td>
                        <td><Input v-model="dataModel.ZlrzNum_wghNum"></Input></td>
                    </tr>
                    </table>
                </Tab-pane> 
            </Tabs> 
            <div style="text-align:right;padding-top:10px">
                <Button type="primary" @click="save()">保存</Button>
                <Button type="ghost" @click="cancel()" style="margin-left: 5px">取消</Button>
            </div>
            <div slot="footer">
                <Alert style="margin-top:5px;text-align:left" banner type="error">
                    填报说明: 填报说明:1.全省范围内从乡（镇）推广站起，逐级全面统计，由州（市）汇总后上报。
                    <span slot="desc">
                        </span>
                </Alert>
            </div>
        </Modal>
        <!--**********************************数据查看框***************************************************************-->
        <Modal v-model="ViewType" :mask-closable="false" width="800">
            <p slot="header" class="title">
                <Icon type="ios-paper" size="20"></Icon>
                <span style="font-size: 20px">蔬菜经营实体情况填报表</span>
            </p>
            <p slot="close">
                <Icon type="close-circled" color="red" size=25></Icon>
            </p>
            <div class="seeTable">
                <table class="reportTable">
                     <tr>
                        <td width="25%">种类</td>
                        <td width="45%" colspan="2">详细类别</td>
                        <td width="15%">单位</td>
                        <td width="15%">数量</td>
                    </tr>
                    <tr>
                        <td rowspan="14">蔬菜企业</td>
                        <td colspan="2">企业总数</td>
                        <td>个</td>
                        <td>{{dataModel.VegCompanyNum}}</td>
                    </tr>
                    <tr>
                        <td  rowspan="3">龙头企业</td>
                        <td>总数</td>
                        <td>个</td>
                        <td>{{dataModel.ZzNum_Num}}</td>
                    </tr>
                    <tr>
                        <td>省级及以上龙头企业</td>
                        <td>个</td>
                        <td>{{dataModel.ZzNum_pro}}</td>
                    </tr>
                    <tr>
                        <td>州县（市）级龙头企业</td>
                        <td>个</td>
                        <td>{{dataModel.ZzNum_city}}</td>
                    </tr>
                    <tr>
                        <td  rowspan="6">按产值分</td>
                        <td>1000万元以下</td>
                        <td>个</td>
                        <td>{{dataModel.ZzNum_yye1}}</td>
                    </tr>
                    <tr>
                        <td>1000～5000万元</td>
                        <td>个</td>
                        <td>{{dataModel.ZzNum_yye2}}</td>
                    </tr>
                     <tr>
                        <td>5000万～1亿元</td>
                        <td>个</td>
                        <td>{{dataModel.ZzNum_yye3}}</td>
                    </tr>
                    <tr>
                        <td>1～5亿元</td>
                        <td>个</td>
                        <td>{{dataModel.ZzNum_yye4}}</td>
                    </tr>
                    <tr>
                        <td>5~10亿元</td>
                        <td>个</td>
                        <td>{{dataModel.ZzNum_yye5}}</td>
                    </tr>
                    <tr>
                        <td>10亿元以上</td>
                        <td>个</td>
                        <td>{{dataModel.ZzNum_yye6}}</td>
                    </tr>
                    <tr>
                        <td  rowspan="4">育苗企业</td>
                        <td>总数</td>
                        <td>个</td>
                        <td>{{dataModel.YmqyNum}}</td>
                    </tr>
                    <tr>
                        <td>育苗500万株以下</td>
                        <td>个</td>
                        <td>{{dataModel.Ymqy1}}</td>
                    </tr>
                    <tr>
                        <td>500万株-1000万株</td>
                        <td>个</td>
                        <td>{{dataModel.Ymqy2}}</td>
                    </tr>
                    <tr>
                        <td>1000万株以上</td>
                        <td>个</td>
                        <td>{{dataModel.Ymqy3}}</td>
                    </tr>
                    <tr>
                        <td rowspan="3">蔬菜经营主体</td>
                        <td colspan="2">蔬菜专业合作组织数量</td>
                        <td>个</td>
                        <td>{{dataModel.VegHzNum}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">参加蔬菜合作组织农户数</td>
                        <td>个</td>
                        <td>{{dataModel.VegNhNum}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">蔬菜合作组织种植面积</td>
                        <td>亩</td>
                        <td>{{dataModel.VegMjNum}}</td>
                    </tr>
                     <tr>
                        <td rowspan="12">相关质量标准认证情况</td>
                        <td colspan="2">国家级农业标准化示范县数量</td>
                        <td>个</td>
                        <td>{{dataModel.ZlrzNum_sfx}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">出口食品农产品质量安全示范区数量</td>
                        <td>个</td>
                        <td>{{dataModel.ZlrzNum_sfq}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">注册商标数</td>
                        <td>个</td>
                        <td>{{dataModel.ZlrzNum_sbs}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">出口基地备案面积</td>
                        <td>亩</td>
                        <td>{{dataModel.ZlrzNum_bamj}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">GAP认证面积</td>
                        <td>亩</td>
                        <td>{{dataModel.ZlrzNum_rzmj}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">GAP认证产品数量</td>
                        <td>个</td>
                        <td>{{dataModel.ZlrzNum_rzsl}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">无公害农产品数</td>
                        <td>个</td>
                        <td>{{dataModel.ZlrzNum_wghmj}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">无公害农产品认证面积</td>
                        <td>亩</td>
                        <td>{{dataModel.ZlrzNum_wghmj}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">绿色产品数</td>
                        <td>个</td>
                        <td>{{dataModel.ZlrzNum_bluecp}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">绿色产品认证面积</td>
                        <td>亩</td>
                        <td>{{dataModel.ZlrzNum_bluecpmj}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">地理标志证明商标数</td>
                        <td>个</td>
                        <td>{{dataModel.ZlrzNum_dlsb}}</td>
                    </tr>
                    <tr>
                        <td colspan="2">地理标志产品保护认证数</td>
                        <td>个</td>
                        <td>{{dataModel.ZlrzNum_dlbh}}</td>
                    </tr>
                </table>
            </div>
            <div slot="footer">
                <Alert style="margin-top:5px;text-align:left" banner type="error">
                    填报说明: 填报说明:1.全省范围内从乡（镇）推广站起，逐级全面统计，由州（市）汇总后上报。
                    <br/>
                    <br/>
                    数据平衡关系:
                    <br/>                    
                    <span style="color:red">(1)&nbsp;&nbsp;蔬菜企业总数>育苗企业总数</span>
                    <br/>
                   
                    <span style="color:red">(2)&nbsp;&nbsp;龙头企业总数>省级及以上龙头企业+州县(市)级龙头企业</span>
                    <br/>
                    
                    <span style="color:red">(3)&nbsp;&nbsp;育苗企业总数=育苗500万株以下企业+500万株-1000万株企业+1000万株以上企业</span>
                    <br/>
                    
                    <span style="color:red">(4)&nbsp;&nbsp;龙头企业总数>省级及以上龙头企业+州县(市)级龙头企业</span>
                     <br/>
                    <br/>
                    特别提醒:                     
                    <br/>
                    <span style="color:red">&nbsp;&nbsp;(1)外销量只在生产总量存在的情况下才存在</span>
                    <span style="color:red">&nbsp;&nbsp;(2)外销额只在生产总额存在的情况下才存在</span>
                    <span slot="desc"></span>
                </Alert>
            </div>
        </Modal>
    </div>
</template>
<script>
    export default {
        data() {
            return {
                self: this,
                TableCodeList: this.GetGroupDict("ReportTableName"), //表名称
                CreateYearList: this.GetGroupDict("ReportYear"), //填报年度
                CycleList: this.GetGroupDict("ReportCycle"), //
                TabTitleList: [], //tab选项卡列表
                AreaList: [], //所属行政区划数组,
                selectTabName: '',
                showType: false, //编辑框状态开关
                ViewType: false, //查看框状态开关
                TableHeader: [{
                        title: '报表名称',
                        key: 'ReportCodeName',
                        ellipsis: true
                    },
                    {
                        title: '归属地区',
                        key: 'AreaCodeName',
                        width: 200
                    },
                    {
                        title: '填报年度',
                        key: 'FillInYearName',
                        width: 110
                    },
                    {
                        title: '填报周期',
                        key: 'TimesTypeName',
                        width: 110
                    },
                    {
                        title: '周期详情',
                        key: 'TimesCycleName',
                        width: 110
                    },
                    {
                        title: '审核意见',
                        key: 'Opinion',
                        width: 150,
                        ellipsis: true
                    },
                    {
                        title: "报表状态",
                        key: "StatusName",
                        width: 110,
                        render:(h,params)=>{
                            switch (params.row.Status * 1) {
                                case 0: //审核未通过
                                    return h('span',{class:{Error:true}},params.row.StatusName);
                                case 1: //未填报
                                    return h('span',{class:{NoReport:true}},params.row.StatusName);
                                case 2: //已填报
                                    return h('span',{class:{AlreadyReport:true}},params.row.StatusName);
                                case 3: //已上报
                                    return h('span',{class:{UpReport:true}},params.row.StatusName);                                    
                                case 4: //审核通过
                                    return h('span',{class:{Success:true}},params.row.StatusName);                                    
                                case 5: //锁定
                                    return h('span',{class:{Error:true}},params.row.StatusName);                                    
                                default:
                                    return h('span',{class:{Default:true}},params.row.StatusName);                                    
                            }
                        }
                    },
                    {
                        title: '添加时间',
                        key: 'StrAddTime',
                        width: 180
                    },
                    {
                        title: '操作',
                        key: 'action',
                        width: 240,
                        align: 'center',
                        render:(h,params)=>{
                            switch (params.row.Status * 1) {
                                case 0: //审核未通过
                                        return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);
                                case 1: //未填报
                                     return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);
                                case 2: //已填报
                                    return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);
                                case 3: //已上报
                                     return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true},attrs:{disabled:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true},attrs:{disabled:true}, props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);                                   
                                case 4: //审核通过
                                    return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);                                 
                                case 5: //锁定
                                     return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);                               
                                default:
                                     return h('div', [
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.See(params.row.Id,params.row.ReportCode); }}}, '查看'),
                                        h('Button', {class:{ieditColor:true}, props: {type:'ghost',size:'small',icon:'ios-compose'},style: {marginRight: '5px'},on: {click: () => {this.Edit(params.row.Id,params.row.ReportCode); }}}, '填报'),
                                        h('Button', {class:{ieditColor:true}, attrs:{disabled:true},props: {type:'ghost',size:'small',icon:'arrow-up-a'},on: {click: () => {this.DataUp(params.row.Id,'3',''); }}}, '上报')
                                    ]);                                 
                            }
                        }
                    }
                ],
                IsEdit: false, //是否编辑
                IsUp: false, //是否上报
                //查询模型：根据需求删除不不要查询条件
                //蔬菜生产情况表代码
                searchModel: {
                    Id: '',
                    ReportCode: 'VegProsecution',
                    FillInYear: '',
                    TimesType: '',
                    AreaCode: '',
                    PageNumber: 1,
                    PageSize: 20,
                    Status: '',
                    Opinion: ''
                },
                dataModel: {//编辑模型
                    Id: 0,
                    ReportId:'', 
                    VegCompanyNum:'', 
                    ZzNum_Num:'',
                    ZzNum_pro:'', 
                    ZzNum_city:'', 
                    ZzNum_yye1:'', 
                    ZzNum_yye2:'', 
                    ZzNum_yye3:'', 
                    ZzNum_yye4:'', 
                    ZzNum_yye5:'', 
                    ZzNum_yye6:'', 
                    YmqyNum:'', 
                    Ymqy1:'', 
                    Ymqy2:'', 
                    Ymqy3:'', 
                    VegHzNum:'', 
                    VegNhNum:'', 
                    VegMjNum:'', 
                    ZlrzNum_sfx:'', 
                    ZlrzNum_sfq:'', 
                    ZlrzNum_sbs:'', 
                    ZlrzNum_bamj:'', 
                    ZlrzNum_rzmj:'', 
                    ZlrzNum_rzsl:'', 
                    ZlrzNum_wghmj:'',
                    ZlrzNum_wghNum:'',  
                    ZlrzNum_bluecp:'', 
                    ZlrzNum_bluecpmj:'', 
                    ZlrzNum_dlsb:'', 
                    ZlrzNum_dlbh:'', 
                },
                pageSizeOpts: [20, 40, 50], //默认分页最大设置
                datas: {}, //table数据对象
                dataIds: [],
                ctx: this, //table数据上下文
                clientHeight: window.innerHeight - 270, //表格默认高度
            }
        },
        mounted() {
            //table高度计算方法
            const that = this;
            window.onresize = () => {
                return (() => {
                    that.clientHeight = window.innerHeight - 220;
                })()
            };
        },
        methods: {
            checkTap(){//龙头企业数据校验
                var VegCompanyNum=this.dataModel.VegCompanyNum;//蔬菜企业数量
                var ZzNum_Num=this.dataModel.ZzNum_Num;//龙头企业总数
                var ZzNum_pro=this.dataModel.ZzNum_pro;//省级以上龙头企业
                var ZzNum_city=this.dataModel.ZzNum_city;//州县(市)级龙头企业
                if(VegCompanyNum==null&&ZzNum_Num!=null)
                {//蔬菜企业总数为空，而龙头企业总数不为空-----校验错误
                    this.$Modal.error({
                        title: "提示信息",
                        content: "蔬菜企业总数为空，而龙头企业总数不为空!!!"
                    });
                    return false;
                }
                else{
                    if(ZzNum_Num==null)
                    {
                        if(ZzNum_pro!=null||ZzNum_city!=null)
                        {
                            this.$Modal.error({
                                title: "提示信息",
                                content: "蔬菜企业总数为空，而龙头企业总数不为空!!!"
                            });
                            return false;
                        }
                        else{
                            return true;
                        }   
                    }//当龙头企业数据为空时，省级和县市级不能包含数据
                    else{
                        if(Number(VegCompanyNum)<Number(ZzNum_Num))
                        {
                             this.$Modal.error({
                                title: "提示信息",
                                content: "蔬菜企业总数>龙头企业总数"
                            });
                            return false;
                        }
                        else{
                            //平衡关系:龙头企业总数>省级以上龙头企业+州县(市)级龙头企业
                            if(Number(ZzNum_Num)<Number(ZzNum_pro)+Number(ZzNum_city))
                            {
                                this.$Modal.error({
                                    title: "提示信息",
                                    content: "龙头企业总数>省级以上龙头企业+州县(市)级龙头企业"
                                });
                                return false;
                            }
                            else{
                                return true;
                            }
                        }
                    }
                }
            },
            checkProduct(){//产值数据校验
                var VegCompanyNum=this.dataModel.VegCompanyNum;//蔬菜企业数量
                var ZzNum_yye1=this.dataModel.ZzNum_yye1;//1000万元以下
                var ZzNum_yye2=this.dataModel.ZzNum_yye2;//1000-5000
                var ZzNum_yye3=this.dataModel.ZzNum_yye3;//5000-1亿
                var ZzNum_yye4=this.dataModel.ZzNum_yye4;//1亿-5亿
                var ZzNum_yye5=this.dataModel.ZzNum_yye5;//5亿-10亿
                var ZzNum_yye6=this.dataModel.ZzNum_yye6;//10亿以上
                if(VegCompanyNum==null)
                {
                    if(ZzNum_yye1!=null||ZzNum_yye2!=null||ZzNum_yye3!=null||ZzNum_yye4!=null||ZzNum_yye5!=null||ZzNum_yye6!=null)
                    {
                        this.$Modal.error({
                            title: "提示信息",
                            content: "蔬菜企业数据为空，但其子项不为空!!!"
                        });
                        return false;
                    }
                }
                else{
                    VegCompanyNum=VegCompanyNum==null?0:Number(VegCompanyNum);
                    ZzNum_yye1=ZzNum_yye1=null?0:Number(ZzNum_yye1);//1000万元以下
                    ZzNum_yye2=ZzNum_yye2=null?0:Number(ZzNum_yye2);//1000-5000
                    ZzNum_yye3=ZzNum_yye3=null?0:Number(ZzNum_yye3);//5000-1亿
                    ZzNum_yye4=ZzNum_yye4=null?0:Number(ZzNum_yye4);//1亿-5亿
                    ZzNum_yye5=ZzNum_yye5=null?0:Number(ZzNum_yye5);//5亿-10亿
                    ZzNum_yye6=ZzNum_yye6=null?0:Number(ZzNum_yye6);//10亿以上
                    if(VegCompanyNum!=ZzNum_yye1+ZzNum_yye2+ZzNum_yye3+ZzNum_yye4+ZzNum_yye5+ZzNum_yye6)
                    {
                        this.$Modal.error({
                            title: "提示信息",
                            content: "蔬菜企业总数=1000万元以下+1000～5000万元+5000万～1亿元+1～5亿元+5~10亿元+10亿元以上!!!"
                        });
                        return false;
                    }
                    else{
                        return true;
                    }
                }
                
            },
            checkGrow(){//育苗企业数据校验
                var VegCompanyNum=this.dataModel.VegCompanyNum;//蔬菜企业数量            
                var YmqyNum=this.dataModel.YmqyNum;//育苗企业数量
                var Ymqy1=this.dataModel.Ymqy1;//育苗500万株以下
                var Ymqy2=this.dataModel.Ymqy2; //育苗500万株-1000万株
                var Ymqy3=this.dataModel.Ymqy3; //育苗500万株-1000万株
                if(VegCompanyNum==null&&YmqyNum!=null)
                {
                    this.$Modal.error({
                        title: "提示信息",
                        content: "蔬菜企业为空,但育苗企业不为空，两者存在包含关系，请检查数据!!!"
                    });
                    return false;
                }
                else{
                    if(YmqyNum==null)
                    {
                        if(Ymqy1!=null||Ymqy2!=null||Ymqy3!=null)
                        {
                            this.$Modal.error({
                                title: "提示信息",
                                content: "育苗企业总数为空!!!"
                            });
                            return false;
                        }
                    }
                    else{
                        VegCompanyNum=VegCompanyNum==null?0:Number(VegCompanyNum);
                        YmqyNum=YmqyNum==null?0:Number(YmqyNum);
                        Ymqy1=Ymqy1==null?0:Number(Ymqy1);
                        Ymqy2=Ymqy2==null?0:Number(Ymqy2);
                        Ymqy3=Ymqy3==null?0:Number(Ymqy3);
                        if(VegCompanyNum<YmqyNum)
                        {
                            this.$Modal.error({
                                title: "提示信息",
                                content: "育苗企业数据大于蔬菜企业数据!!!"
                            });
                            return false;
                        }
                        else if(YmqyNum!=Ymqy1+Ymqy2+Ymqy3){
                            this.$Modal.error({
                                title: "提示信息",
                                content: "育苗企业总数不等于它的各子项相加!!!"
                            });
                            return false;
                        }
                        else{
                            return true;
                        }
                    }
                }
            },
            checkData:function(){//数据平衡关系校验
                if(this.checkTap()&&this.checkProduct()&&this.checkGrow()){
                    return true;
                }
                else{
                    return false;
                }
            },
            TmpDown:function(){//模板下载
                alert(this.searchModel.ReportCode); 
            },
            See: function(id, reportCode) { //数据查看
                var self = this;
                self.$http.get("Report", {
                    params: {
                        id: id,
                        reportCode: reportCode
                    }
                }).then( //获取数据编辑项的值
                    function(res) {
                        switch (res.data.list.status) {
                            case 1:
                                self.dataModel=res.data.list.model;
                                self.ViewType = true;
                                break;
                            case 0:
                                self.$Modal.error({
                                    title: "提示信息",
                                    content: "数据加载失败!!!"
                                });
                                break;
                            case -1:
                                self.$Modal.error({
                                    title: "提示信息",
                                    content: "数据加载失败!!!"
                                });
                                break;
                        }
                    }
                );
            },
            getTab(name) {
                //console.log(name);
                this.selectTabName = name;
            },
            //查看报表
            showInfo(id, reportCode) {},
            //获取当前页码
            getPageNumber(pageIndex) {
                this.searchModel.PageNumber = pageIndex;
                this.getPageData();
            },
            //获取当前分页大小
            getPageSize(pageSize) {
                this.searchModel.PageSize = pageSize;
                this.getPageData();
            },
            //获取this.datas: {},//table数据对象
            getPageData() {
                var self = this;
                var user = this.GetlocaStorage("VegUserInfo");
                this.searchModel.AreaCode = user.AreaCode;
                self.$http.post('Report/PostPageList', this.searchModel).then(function(res) {
                    if (res.data.status === 1) {
                        self.datas = res.data;
                    } else {
                        self.$Modal.error({
                            title: '提示信息',
                            content: res.data.message
                        });
                    }
                });
            },
            //编辑获取对象传入id
            Edit: function(id, reportCode) {
                var self = this;
                this.$http.get("Report", {
                    params: {
                        id: id,
                        reportCode: reportCode
                    }
                }).then( //获取数据编辑项的值
                    function(res) {
                        switch (res.data.list.status) {
                            case 1:
                                // self.initTab(self, res.data.list.model);
                                self.dataModel=res.data.list.model;
                                self.modalShow();
                                // self.selectTabName = self.TabTitleList[0].SortCode;
                                break;
                            case 0:
                                self.$Modal.error({
                                    title: "提示信息",
                                    content: "编辑数据加载失败!!!"
                                });
                                break;
                            case -1:
                                self.$Modal.error({
                                    title: "提示信息",
                                    content: "编辑数据加载失败!!!"
                                });
                                break;
                        }
                    }
                );
            },
            //保存方法
            save() {
                var self = this;
                if(self.checkData()){
                    this.$http.put('VegProsecution', self.dataModel).then(
                        function(res) {
                            if (res.data.status == 1) {
                                self.getPageData(); //读取分页数据
                                self.$Notice.success({
                                    title: '保存成功！',
                                    desc: false
                                });
                            } else {
                                self.$Modal.warning({
                                    title: "提示信息",
                                    content: "更新失败,请与管理员联系!"
                                });
                            }
                        });
                }
            },
            //数据上报
            DataUp: function(ReportId, Status, Msg) {
                var self = this;
                self.searchModel.Id = ReportId;
                self.searchModel.Status = Status;
                self.searchModel.Opinion = Msg;
                self.$Modal.confirm({
                    title: '提示信息',
                    content: '<p>数据上报后，不能再更改，是否继续上报？</p>',
                    onOk: () => {
                        self.$http.post('Report/PostUpStatus', self.searchModel).then(function(res) {
                            if (res.data.status === 1) {
                                self.$Notice.success({
                                    title: '数据上报成功',
                                    desc: false
                                });
                                self.searchModel.Status = '';
                                self.getPageData(); //读取分页数据
                            } else {
                                self.$Notice.success({
                                    title: '数据上报失败',
                                    desc: res.data.messages
                                });
                            }
                        });
                    },
                    onCancel: () => {}
                });
            },
            //编辑框打开
            modalShow() {
                this.showType = true;
            },
            //编辑框关闭
            modalHide() {
                this.showType = false;
            },
            //取消方法
            cancel() {
                this.showType = false; //关闭modal
                this.TabTitleList = [];
            },
            //重置model
            restModel(modelname) {
                this.$refs[modelname].resetFields(); //重置model
            },
            //全选方法
            selectAll(selection) {
                this.dataIds = selection;
            },
            //checkbox选中方法
            selectSingel(selection, row) {
                this.dataIds = selection;
            },
            //checkbox取消选中方法
            selecChange(selection) {
                this.dataIds = selection;
            },
            //批量删除
            multiSelect() {
                var self = this;
                if (this.dataIds.length !== 0) {
                    self.$Modal.confirm({
                        title: '提示信息',
                        content: '<p>数据删除后不可恢复，确定要删除？</p>',
                        onOk: () => {
                            var ids = this.getDataIds(this.dataIds);
                            this.$http.post("GenerateLog/PostBatchDelete", ids).then(
                                function(res) {
                                    if (res.data.status == 1) {
                                        self.dataIds = [];
                                        self.$Notice.success({
                                            title: '删除成功！',
                                            desc: false
                                        });
                                        self.getPageData();
                                    } else {
                                        self.$Modal.error({
                                            title: "提示信息",
                                            content: "数据删除失败!!!"
                                        });
                                    }
                                }
                            );
                        }
                    });
                } else {
                    self.$Modal.warning({
                        title: "提示信息",
                        content: "请选择需要删除的数据!"
                    });
                }
            },
            getDataIds(idList) {
                var ids = [];
                if (idList.length !== 0) {
                    for (var i = 0; i < idList.length; i++) {
                        ids.push(idList[i].Id);
                    }
                }
                return ids;
            }
        },
        //创建Vue页面方法
        created: function() {
            //创业Vue前调用获取this.datas: {},//table数据对象
            this.getPageData();
        },
        watch: {
            //需要监听的在此处新增监听对象
        }
    }
</script>
